#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <map>
#define maxn 19
using namespace std;
map<string,int> bh;
string shuzi[maxn]={"0","1","2","3","4","5","6","7","8","9","10","11","12","13"};
string name[maxn]={"能量","自杀","防御","反弹","刀","闪电","刀加防御","续命","破防","黑洞攻击","食人花","火球","全面刀","自杀up"};
int *m;
int *n;
enum status {
    youdie,idie,other,tsy,tsi
};
int nl[]= {-1,0,1,1,2,3,3,5,4,10,14,5,6,3};
status s[maxn][maxn]= {{other,youdie,other,other,idie,tsi,idie,other,idie,idie,idie,idie,idie,idie},
	{idie,other,idie,youdie,idie,idie,idie,idie,idie,idie,idie,idie,idie,other},
	{other,youdie,other,other,other,other,other,other,idie,idie,idie,other,idie,youdie},
	{other,idie,other,other,youdie,tsy,other,other,youdie,idie,idie,idie,idie,youdie},
	{youdie,youdie,other,idie,other,youdie,idie,youdie,idie,idie,idie,idie,idie,youdie},
	{tsy,youdie,other,tsi,idie,other,idie,tsy,idie,idie,idie,idie,idie,youdie},
	{youdie,youdie,other,other,youdie,youdie,other,youdie,idie,idie,idie,youdie,idie,youdie},
	{other,youdie,other,other,idie,tsi,idie,other,idie,idie,idie,idie,idie,youdie},
	{youdie,youdie,youdie,idie,youdie,youdie,youdie,youdie,other,idie,idie,other,idie,youdie},
	{youdie,youdie,youdie,youdie,youdie,youdie,youdie,youdie,youdie,other,idie,youdie,youdie,youdie},
	{youdie,youdie,youdie,youdie,youdie,youdie,youdie,youdie,youdie,youdie,other,youdie,youdie,youdie},
	{youdie,youdie,other,youdie,youdie,youdie,youdie,youdie,other,idie,idie,other,idie,youdie},
	{youdie,youdie,youdie,youdie,youdie,youdie,youdie,youdie,youdie,idie,idie,youdie,other,youdie},
	{youdie,other,idie,idie,idie,idie,idie,idie,idie,idie,idie,idie,idie,other}
};
string cs="电脑出";
int main() {
	for(int i=0;i<maxn;i++){
		bh[name[i]]=i;
	}
	for(int i=0;i<maxn;i++){
		bh[shuzi[i]]=i;
	}
	srand(time(0));
	int number;
	number=3;
	m=(int*)(malloc(number*sizeof(int)));
	n=(int*)(malloc(number*sizeof(int)));
	for(int i=1; i<=number; i++) {
		m[i]=1;
		n[i]=0;
	}
	bool x1=false,x2=false;
	int s1=-2,s2=-2;
	int j=0;
	while(1) {
		int c2,c1;
		string c1c;
		if(!x1) {
			printf("请输入您出什么");
			cin >> c1c;
			c1=bh[c1c];
			if(nl[c1]>n[2]) {
				puts("开挂禁赛");
				break;
			}
			n[2]-=nl[c1];
			s1--;
		} else {
			c1=0;
			s1--;
			if(s1==0) {
				x1=false;
			}
		}
		if(!x2&&(!x1&&(s1!=-1))) {
			c2=rand()%10;
			while(nl[c2]>n[1]||((c2!=0)&&(j==0||j==1))||(n[1]<5&&c2==5)||(n[1]<2&&c2==1)||(n[2]<2&&(c2==2||c2==3))) {
				c2=rand()%maxn;
			}
		    cout << cs+name[c2]+"\n";
			n[1]-=nl[c2];
			s2--;
		}
		else if(!x2&&n[1]==0){
		    if(s1==1){
		        c2=0;
		    }
		    if(s1==0){
		        c2=0;
		    }
		    if(s1==-1){
		        c2=3;
		    }
		    cout << cs << name[c2] << "\n";
			n[1]-=nl[c2];
		}
		else if(!x2){
			if(s1==1){
				c2=0;
			}
			if(s1==0){
				c2=4;
			}
		    cout << cs << name[c2] << "\n";
			n[1]-=nl[c2];
		}
		 else {
			c2=0;
			s2--;
			if(s1==0) {
				x2=false;
			}
		}
		if(s[c1][c2]==youdie) {
		    m[2]--;
		    if(c1==9){
		        m[2]--;
		    }
		    if(m[2]<=0){
		        puts("you win!");
		        break;
		    }
		}
		if(s[c1][c2]==idie) {
		    m[1]--;
		    if(c2==9){
		        m[1]--;
		    }
		    if(m[1]<=0){
		        puts("you die!");
		        break;
		    }
		}
		if(s[c1][c2]==tsy){
			x2=true;
			s2=1;
		}
		if(s[c1][c2]==tsi){
			x1=true;
			s1=1;
		}
		if(c1==7) {
		    m[1]++;
		}
		if(c2==7) {
		    m[2]++;
		}
		j++;
	}
	return 0;
}


